package com.rd.student.ruanjian.class4.lichunquan.kaoshi;

import java.io.*;
import java.util.Scanner;

public class Demo01 {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        StringBuilder s = new StringBuilder();
        for (int i = 0; i < 3; i++) {
            System.out.println("输入姓名");
            String name = sc.next();
            System.out.println("输入语文成绩");
            int YuWen = sc.nextInt();
            System.out.println("输入语数学成绩");
            int ShuXue = sc.nextInt();
            int sum  = YuWen+ShuXue;
            System.out.println("送分为 : " + sum);
            Student s1 = new Student(name,YuWen,ShuXue,sum);
            s.append(s1.toString()).append("\n");
        }
        String str = s.toString();
        InputInfo inputInfo = new InputInfo();
        inputInfo.info(str);
    }
}

class InputInfo {
    File file = new File("D:\\gitclone\\rd2304\\src\\com\\rd\\student\\ruanjian\\class4\\lichunquan\\kaoshi");
    BufferedWriter bw = new BufferedWriter(new FileWriter(file+"\\Student.text"));

    InputInfo() throws IOException { }
    void info(String s) throws IOException {
        String str = "姓名 语文成绩 数学成绩 总分";
        bw.write(str);
        bw.write(s);
        bw.close();
    }

}

class Student {
    private String name;
    private int  YuWen;
    private int ShuXue;
    private int sum;
    public Student(String name, int yuWen, int shuXue,int sum) {
        this.name = name;
        this.YuWen = yuWen;
        this.ShuXue = shuXue;
        this.sum = sum;
    }

    @Override
    public String toString() {
        return name + "    " + YuWen + "    "+ ShuXue + "    " + sum
              ;
    }
}
